package xin.mashibo.pattern.prototype;

import java.util.HashMap;
import java.util.Map;

/**
 * 管理类
 *
 * @author MaShibo
 * 日期 :  2019/1/22
 */
public class Manager {

    private Map<String, Product> showcase = new HashMap<>();

    public void register(String name, Product proto) {
        showcase.put(name, proto);
    }

    public Product create(String protoName) {
        Product p = showcase.get(protoName);
        return p.createClone();
    }

}
